package com.sh.caryr.erp.entity.basis;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.sh.caryr.erp.entity.BaseEntity;
import com.sh.caryr.erp.entity.enums.SalesPlatform;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@TableName("erp_comp_cfg")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class CompCfg extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    private String accessToken;

    private String appKey;

    private String appSecret;

    private String extPlatform;

    private int syncOrderDays;

    private int syncAsOrderDays;

    public void setExtPlatform(String extPlatform) {
        this.extPlatform = extPlatform;
        SalesPlatform eco = SalesPlatform.getEnum(extPlatform);
        this.platformName = eco != null ? eco.getText() : "";
    }

    @TableField(exist = false)
    private String platformName;
}
